package cn.ecnu.user.mapper;

import cn.ecnu.user.pojo.Notification;
import cn.ecnu.user.vo.NotificationFrontVo;
import cn.ecnu.user.vo.NotificationVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NotificationMapper {


    @Insert("INSERT INTO `notification`(user_id, message) VALUES (#{userId}, #{message})")
    int addNotificationByUid(NotificationFrontVo vo);

    @Select("SELECT * FROM `notification` WHERE user_id = #{uid}")
    List<Notification> getNotificationsByUid(@Param("uid") Integer uid);

    @Update("UPDATE `notification` SET is_read = #{isRead} WHERE notification_id = #{notificationId}")
    int updateNtReadStatus(NotificationVo vo);
}
